<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ page session="false" %>
<script type="text/javascript">
<!--

//-->
function linkify(text) {  
    var urlRegex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;  
    return text.replace(urlRegex, function(url) {  
            return '<a href=\"' + url + '\">' + url + '</a>';  
        
        });  
}
function findAt(text) {  
    var urlRegex =/((@)[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;  
    return text.replace(urlRegex, function(url) {  
            return '<b><span class=\"test\" style=\"' + 'color:#f00;' + '\">' + url + '</span></b>';  
        
        });  
}
$(function(){
 	$.each($("#tweets > span.tweetText"), function(i, val) {
	      
	      var currentText = $(this).text();
	      var linkifiedText = linkify(currentText);
	      
	      $(this).html(findAt(linkifiedText));
	}); 
 	
 	$('#tweets span.test').bind('mouseenter', function() {
 		console.log($(this));
 	});
});

</script>
<c:forEach var="profile" items="${account}">
	<c:out value="${profile.name}"></c:out>
</c:forEach>
<div id="tweets">
<c:forEach var="tweet" items="${tweets}">
	<hr/>
	<span class="tweetText">${tweet.text}</span>
	
	<b><c:out value="${tweet.fromUser}"></c:out></b><br/>
	
</c:forEach>
</div>